home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / cy.lha / cy next >
Text File  |  1996-01-10  |  18KB  |  721 lines

  1. /*
  2.  * cy    Copyright © 1995 by Rick Younie
  3.  *
  4.  * $VER: v1.1    Thu Jan 4 1996
  5.  *        rick@emma.panam.wimsey.com
  6.  *        rick@freenet.vancouver.bc.ca
  7.  *
  8.  * USAGE: '?' for usage
  9.  *
  10.  * SYNOPSIS: 
  11.  *    - CyberCron management program
  12.  *
  13.  */
  14.     signal on BREAK_C
  15.     signal on HALT
  16.  
  17.   /*---------------- USER SETTABLE OPTIONS (begin) ------------------------*/
  18.     screenwidth        = 640
  19.     screenheight    = 200
  20.     editor            = 'C:ed -sticky'        /* editor must hang on to CLI */
  21.     CyberCron        = 'ME:Tools/CyberCron'        /* path+name of CC program */
  22.     crontab            = 'SYS:S/CronTab'
  23.     sendmail        = '"sendmail -f %s -R *"%s*""'
  24.     startcmd        = CyberCron 'CRONTAB' crontab 'SENDMAIL' sendmail
  25.     logfile            = 'LOGS:CyberCron.log'
  26.   /*---------------- USER SETTABLE OPTIONS (end) --------------------------*/
  27.  
  28.     lf                = '0a'x
  29.     cr                = '0d'x
  30.     crlf            = cr || lf
  31.     csi                = '9b'x
  32.     font            = 8
  33.     rows            = screenheight % font - 2
  34.     cols            = screenwidth % font - 1
  35.  
  36. /*    -------------------------------------------------------------------
  37.  *
  38.  */
  39. Main:
  40.     address 'CYBERCRON'
  41.     options results
  42.     options failat 99
  43.     parse arg option
  44.  
  45.     select
  46.         when option = '-n' then call NextEvent
  47.         when option = '-l' then call ListEventsSorted
  48.         when option = '-L' then call ListEvents
  49.  
  50.         when option = '-e' then call Edit
  51.  
  52.         when option = '-b' then call StartCyber
  53.         when option = '-q' | option = '-k' then call KillCyber
  54.  
  55.         when option = '-s'
  56.             then if Suspend_Resume('SUSPEND') then say ShowStatus()
  57.         when option = '-r'
  58.             then if Suspend_Resume('RESUME') then say ShowStatus()
  59.  
  60.         when option = '-g' then call ToggleLog
  61.  
  62.         when option = '' then call RawStuff
  63.  
  64.         otherwise Call Usage
  65.     end
  66.     exit 0
  67.  
  68. /*####################################################################
  69.   ##                         raw window                             ##
  70.   ####################################################################*/
  71.  
  72. /*  -----------------------------------------------------------------*/
  73.  
  74. RawStuff:
  75.  
  76.     cursorUp        = '41'x
  77.     cursorDown        = '42'x
  78.     cursorRight        = '43'x
  79.     cursorLeft        = '44'x
  80.  
  81.     if ~Running()
  82.         then call ErX "..CyberCron not running - 'cy ?' for Usage"
  83.  
  84.     call MakeRaw
  85.  
  86. Refresh:
  87.     call WriteSkel            /* write header,footer */
  88.  
  89. ReScan:
  90.     numevents = ReadEvents()        /* get all queued events from CC */
  91.  
  92.     if numevents = 0    then page = 0
  93.                         else page = 1
  94.     row                = 1
  95.  
  96.     itemsPerPage    = rows - 8
  97.     itemsLastPage    = numevents // itemsPerPage
  98.     maxpage            = numevents % itemsPerPage + (itemsLastPage~=0)
  99.  
  100.     items.            = itemsPerPage
  101.     items.0            = 1
  102.     if itemsLastPage = 0    then items.maxpage = itemsPerPage
  103.                             else items.maxpage = itemsLastPage
  104.  
  105.     if numevents~=0 then call WritePage
  106.     else call WriteSkel
  107.  
  108.     /* 
  109.      * we spend most of our time here, handling keystrokes
  110.      */
  111.     do forever
  112.  
  113.         oldpos = row
  114.         char = readch('STDIN', 1)
  115.  
  116.         select
  117.  
  118.             /* handle cursor keys */
  119.             when char = '9b'x then do
  120.                 char = readch('STDIN', 1)
  121.                 select
  122.                     when numevents=0 then nop
  123.                     when char = cursorDown then do
  124.                         row = row + 1
  125.                         if row > items.page then row = 1
  126.                         call MoveCursor
  127.                     end
  128.                     when char = cursorUp then do
  129.                         row = row - 1
  130.                         if row = 0 then row = items.page
  131.                         call MoveCursor
  132.                     end
  133.                     when char = cursorRight then do
  134.                         if page ~= maxpage then do
  135.                             page = page + 1
  136.                             call WritePage
  137.                         end
  138.                     end
  139.                     when char = cursorLeft then do
  140.                         if page > 1 then do
  141.                             page = page - 1
  142.                             call WritePage
  143.                         end    
  144.                     end
  145.                     otherwise nop
  146.                 end
  147.  
  148.             end        /* cursor keys */
  149.  
  150.             /* not a cursor key */
  151.             otherwise do
  152.                 select
  153.                     when char = 's'
  154.                         then if Suspend_Resume('SUSPEND') then call WriteStatus
  155.                     when char = 'r'
  156.                         then if Suspend_Resume('RESUME') then call WriteStatus
  157.                     when char = 'a' then call AddEvent('NORM')
  158.                     when char = 'A' then call AddEvent('CC')
  159.                     when char = 'e' then call EditCrontab
  160.                     when char = 'n' then signal Refresh /* ReScan? */
  161.                     when char = 'q' then do
  162.                         if Quit() then leave
  163.                         call MsgAndDelay '..quit aborted'
  164.                     end
  165.                     when char = 'Q' then leave
  166.                     when char = 'g' then call ToggleLogFile
  167.  
  168.                     /* dont allow the following options if no events */
  169.                     when numevents = 0 then nop
  170.  
  171.                     when char = 't' then do
  172.                         tmp = (page-1)*itemsPerPage + row
  173.                         tag.tmp = (tag.tmp=0)    /* toggle flag */
  174.                         if tag.tmp    then star = '*'
  175.                                     else star = ' '
  176.                         call writech 'STDOUT',csi || row+2';3H'star
  177.                         row = row + 1
  178.                         if row > items.page then row = 1
  179.                         call MoveCursor
  180.                     end
  181.  
  182.                     /*    space bar follows Tin behavior
  183.                      *        >1 page?
  184.                      *            - if ~last page, go to next
  185.                      *            - else if not at end of page, go to end
  186.                      *                    - else go to first page
  187.                      *        =1 page; if not at bottom, go there
  188.                      *                    else go to top
  189.                      */
  190.                     when char = ' ' then do
  191.                         if maxpage > 1 then do
  192.                             if page ~= maxpage then do
  193.                                 page = page + 1
  194.                                 call WritePage
  195.                             end
  196.                             else do
  197.                                 if row ~= items.page then do
  198.                                     row = items.page
  199.                                     call MoveCursor
  200.                                 end
  201.                                 else do
  202.                                     page = 1
  203.                                     call WritePage
  204.                                 end
  205.                             end
  206.                         end
  207.                         else do    /* only 1 page; go to bot/top */
  208.                             if row = items.page then row = 1
  209.                                                 else row = items.page
  210.                             call MoveCursor
  211.                         end
  212.                     end
  213.  
  214.                     when char = 'd' then call DeleteEvent
  215.                     when char = 'p' then call PurgeRexx
  216.                     otherwise nop
  217.                 end
  218.             end
  219.  
  220.         end /* select */
  221.  
  222.         call PrintTime
  223.  
  224.     end    /* forever */
  225.  
  226.     exit 0
  227.  
  228. MoveCursor:
  229.     call writech 'STDOUT', csi || oldpos+2';1H  '
  230.     call writech 'STDOUT', csi ||    row+2';1H->' || csi || rows';1H'
  231.     return
  232.     
  233. CLineMsg:
  234.     call writech 'STDOUT', csi || rows';1H'csi'K   'arg(1) || cr
  235.     return
  236.  
  237. /*  -------------------------------------------------------------------
  238.  *    
  239.  */
  240. WriteSkel:
  241.     prompt.1        = '[s]uspend [r]esume  [t]ag [d]elete  [e]dit_crontab resca[n]  lo[g]_file'
  242.     prompt.2        = '<=prev page  (spacebar)  next page=>  [aA]dd  [qQ]uit  [p]urge_rexx_events'
  243.  
  244.     'VERSION'
  245.     title    = '-- cy -- [CyberCron' word(result,1)']'
  246.  
  247.     call writech 'STDOUT', csi'H'csi'J' || center(title,cols) || crlf
  248.     call writech 'STDOUT', csi || rows - 4';1H'center(prompt.1,cols)
  249.     call writech 'STDOUT', csi || rows - 3';1H'center(prompt.2,cols)
  250.  
  251. WriteStatus:
  252.     call writech 'STDOUT', csi || rows - 2';1H'center(ShowStatus(),cols)
  253.     call CLineMsg ''
  254.  
  255. PrintTime:
  256.     call writech 'STDOUT', csi || '1;4H'time()'  'date('E') || csi || rows';1H'
  257.     return
  258.  
  259. /*  ------------------------------------------------------------------- */
  260. WritePage:
  261.  
  262.     tmp = right('p'page 'of' maxpage,10)
  263.     call writech 'STDOUT', csi || '1;'cols-length(tmp)'H'tmp
  264.  
  265.     offset = (page-1)*itemsPerPage    /* offset into event.i */
  266.  
  267.     /* write this pages events to window */
  268.     do i = 1 to items.page
  269.         tmp = offset + i
  270.         if tag.tmp    then star = '*'
  271.                     else star = ' '
  272.         call writech 'STDOUT', csi || i+2';1H'csi'K  'star || event.tmp || crlf
  273.     end i
  274.  
  275.     /* clear leftover lines */
  276.     do i = items.page+1 to itemsPerPage + 1
  277.         call writech 'STDOUT', csi || i+2';1H'csi'K'
  278.     end i
  279.  
  280.     /* reset to first entry whenever page is redrawn */
  281.     row = 1
  282.     call writech 'STDOUT', csi || row+2';1H->'
  283.  
  284. WipeBottom2:
  285.     /* wipe 2 command lines, positions cursor at bottom */
  286.     call writech 'STDOUT', csi || rows-1';1H'csi'J'csi || rows';1H'
  287.     signal PrintTime
  288.  
  289. /*  ----------------------------------------------------------------
  290.  *    ssc_id.i = 12345678'ext' 12345678 0x12345678    for the sort
  291.  *        - ext=ext+1 for every CC event read so :OBEYQUEUE-type
  292.  *            events dont get mixed up by the sort
  293.  *        - shifted to just 'ssc id' after the sort
  294.  *    event.i = time date event_to_execute
  295.  */
  296. ReadEvents:
  297.  
  298.     tag.        = 0            /* clear tags on a new read */
  299.  
  300.     /* get all events in CC-id format */
  301.     'LIST_EVENTS'
  302.     list = result
  303.  
  304.     if left(list,2)~='0x' then ssc_id.0 = 0    /* no events queued */
  305.  
  306.     else do
  307.         if option = '' then call CLineMsg '..getting events'
  308.         /* fill 'sssc.ext sssc 0x' array for sort */
  309.         ssc_id.0 = words(list)
  310.         do i = 1 to ssc_id.0
  311.             /* get time for its next execution */
  312.             id = word(list,i)
  313.             'EVENT_NEXT_EXEC' id
  314.             ssc =  result
  315.             if ssc = '' then tmp = 0         /* could not be found */
  316.             tmp = ssc || right('0'i,2)    /* 01,02..added to events
  317.                             so QUEUE events of same time dont scramble */
  318.             ssc_id.i = tmp ssc id
  319.         end i
  320.  
  321.         if option = '' then call CLineMsg '..sorting'
  322.  
  323.         /* one of Knuth's sort algorithms
  324.             - rony@wu-wien.ac.at (Rony G. Flatscher) */
  325.         m = 1
  326.         do while (9 * m + 4) < ssc_id.0
  327.             m = m * 3 + 1
  328.         end
  329.     
  330.         do while m > 0
  331.             k = ssc_id.0 - M
  332.             do j = 1 to k
  333.                 q = j
  334.                 do while q > 0
  335.                     l = q + m
  336.                     if ssc_id.q <= ssc_id.l then leave
  337.                     /* switch elements */
  338.                     tmp        = ssc_id.q
  339.                     ssc_id.q = ssc_id.l
  340.                     ssc_id.l = tmp
  341.                     q = q - m
  342.                 end
  343.             end
  344.             m = m % 3
  345.         end        /* sort */
  346.  
  347.         if option = '' then call CLineMsg '..converting'
  348.  
  349.         /* now fill event.i with events sorted as to time */
  350.         today = date('E')
  351.         scnwidth = cols - 4
  352.         do i = 1 to ssc_id.0
  353.  
  354.             parse var ssc_id.i . ssc id
  355.             /* lose the ssc+extension variable to save a little confusion */
  356.             ssc_id.i = ssc id
  357.  
  358.             'SHOW_EVENT' id
  359.             event.i = subword(result,7)        /* the event */
  360.  
  361.             'EXPAND_SSSC' ssc
  362.             parse var result . min hr day mon yr .
  363.             date = right('00'day,2)'/'right('00'mon,2)'/'right(yr,2)
  364.             if date = today then date = '        '
  365.  
  366.             /* truncate for screen */
  367.             event.i = right('00'hr,2)':'right('00'min,2) date event.i
  368.             if length(event.i) > scnwidth then event.i = left(event.i,scnwidth)
  369.         end i
  370.  
  371.     end
  372.  
  373.     return ssc_id.0
  374.  
  375. /*  -------------------------------------------------------------------
  376.  *
  377.  */
  378. PurgeRexx:
  379.     call CLineMsg 'delete rexx events? y/n'
  380.     char = readch('STDIN',1)
  381.     if upper(char)='Y' then do
  382.         'PURGE_REXX_EVENTS'        /* no RC? */
  383.         call MsgAndDelay '..rexx events purged'
  384.     end
  385.     else call MsgAndDelay '..purge aborted'
  386.     signal ReScan
  387.  
  388. /*  -------------------------------------------------------------------
  389.  *
  390.  */
  391. ToggleLogFile:
  392.  
  393.     if right(ShowStatus(),2) = 'ON' then 'CLOSE_LOG_FILE'
  394.     else 'NEW_LOG_FILE' logfile
  395.  
  396.     if RC ~= 0 then call MsgAndDelay '..error toggling' logfile
  397.  
  398.     signal WriteStatus
  399.  
  400.     return
  401.  
  402. /*  -------------------------------------------------------------------
  403.  *
  404.  */
  405. EditCrontab:
  406.     if Edit()~=0 then do
  407.         call CLineMsg '..editor under USER SETTABLE OPTIONS set incorrectly?',
  408.             ' <ret> to continue'
  409.         call readch 'STDIN', 1
  410.         signal Refresh    /* dos can mess up window with err msg */
  411.     end
  412.     signal ReScan
  413.  
  414. Edit:
  415.     address 'COMMAND' editor crontab
  416.     return RC
  417.  
  418. /*  -------------------------------------------------------------------
  419.  *    NORM    = hh:mm event
  420.  *    CC        = min hour day month dow(Sun=0) event
  421.  */
  422. AddEvent:
  423.     parse arg type
  424.  
  425.     prompt.NORM    = 'hh:mm'
  426.     prompt.CC    = 'min hr day mon dow(Sun=0)'
  427.     prompt = csi || rows-1';1H'csi'K'prompt.type' event'csi || rows';1H'
  428.  
  429.     do forever
  430.         call writech 'STDOUT',prompt
  431.         string = GetEvent()
  432.         if string = '' then do
  433.             call MsgAndDelay '..aborting - no add'
  434.             signal WipeBottom2
  435.         end
  436.         if type = 'NORM' then do
  437.             once = ''
  438.             parse var string hr ':' min event
  439.             event = strip(event)
  440.             if abbrev(string,'*:*')
  441.                 then once = ':EXECONCE'
  442.             string = min hr '* * *' once event
  443.         end
  444.  
  445.         'ADD_EVENT' string
  446.  
  447.         /* event was added ok - go get new lineup from CC */
  448.         if RC=0 then do
  449.             call MsgAndDelay 'ok'
  450.             signal ReScan
  451.         end
  452.  
  453.         else do            /* not added - try again */
  454.             call writech 'STDOUT', csi || rows-1';33H **error** [ <ret> to continue ]'
  455.             call readch 'STDIN', 1
  456.             call writech 'STDOUT', csi || rows-1';1H'csi'J'csi || rows
  457.         end
  458.  
  459.     end
  460.     return
  461.  
  462. /*  ----------------handle user add_event input---------------------- */
  463. GetEvent:
  464.     string = ''
  465.  
  466.     do forever
  467.         char = readch('STDIN',1)
  468.         select
  469.             when char > '1f'x & char < '7f'x then do
  470.                 if length(string) <= cols-2 then string = string || char
  471.                 else char = '07'x
  472.                 call writech 'STDOUT',char
  473.             end
  474.  
  475.             /* delete a character */
  476.             when char = '08'x then do
  477.                 if string ~== '' then do
  478.                     string = substr(string,1,length(string)-1)
  479.                     call writech 'STDOUT', csi'D'csi'P'
  480.                 end
  481.             end
  482.  
  483.             /* done */
  484.             when char = cr then break
  485.  
  486.             /* discard cursor key 2nd byte */
  487.             when char = csi then call readch 'STDIN',1
  488.             otherwise nop
  489.         end
  490.     end
  491.     return string
  492.  
  493. /*  -------------------------------------------------------------------
  494.  *    Delete all tagged events; else current event
  495.  */
  496. DeleteEvent:
  497.  
  498.     /* any tagged for delete? */
  499.     tagged = 0
  500.     do i = 1 to numevents
  501.         tagged = tagged + tag.i
  502.     end i
  503.  
  504.     /* got tagged event(s) */
  505.     if tagged > 0 then do
  506.         call CLineMsg 'delete' tagged 'tagged event'copies('s',tagged~=1)'? y/n '
  507.         char = readch('STDIN',1)
  508.         if upper(char)~='Y' then break
  509.         do i = 1 to numevents
  510.             if tag.i then call DeleteOne word(ssc_id.i,2)
  511.         end
  512.         signal ReScan
  513.     end
  514.  
  515.     /* delete current event? */
  516.     call CLineMsg 'delete this event? y/n '
  517.     char = readch('STDIN',1)
  518.     if upper(char)~='Y' then call MsgAndDelay '..aborting - no delete'
  519.     else do
  520.         tmp = (page-1)*itemsPerPage+row
  521.         call DeleteOne word(ssc_id.tmp,2)
  522.         signal ReScan
  523.     end
  524.     return
  525.  
  526. DeleteOne:
  527.     parse arg id
  528.     call CLineMsg '..deleting'
  529.     'DELETE_EVENT' id
  530.     if RC~=0 then call MsgAndDelay '..couldn''t find event'
  531.     return    
  532.  
  533. /* ------ write a message to command line, wait, then wipe it ----- */
  534. MsgAndDelay:
  535.     parse arg msg
  536.     call CLineMsg msg
  537.     call delay 25
  538.     call CLineMsg ''
  539.     return    
  540.  
  541. /*  -------------------------------------------------------------------
  542.  *    
  543.  */
  544. Quit:
  545.     parse value ShowStatus() with ':' status .
  546.     if status = 'ACTIVE' then statusprompt = ''
  547.     else statusprompt = '..CC suspended'
  548.  
  549.     call CLineMsg statusprompt'..really quit? y/n '
  550.     char = readch('STDIN',1)
  551.  
  552.     return upper(char)='Y'
  553.  
  554.  
  555. /*####################################################################
  556.   ##                  do command line requests                      ##
  557.   ####################################################################*/
  558.  
  559. /*  -----------------------------------------------------------------*/
  560. ListEventsSorted:
  561.     if ~Running() then say '..CyberCron isn''t running'
  562.     else do
  563.         num_events = ReadEvents()
  564.         if numevents = 0 then say '..no events queued'
  565.         else do i = 1 to num_events
  566.             say event.i
  567.         end    i
  568.         say '  'ShowStatus()
  569.     end
  570.     return
  571.  
  572. /*  -----------------------------------------------------------------*/
  573. ListEvents:
  574.     if ~Running() then say '..CyberCron isn''t running'
  575.     else do
  576.         'LIST_EVENTS'
  577.         list = result
  578.         if left(list,2)~='0x' then say '..no events queued'
  579.         else do i = 1 to words(list)
  580.             'SHOW_EVENT' word(list,i)
  581.             say subword(result,2)
  582.         end
  583.         say '  'ShowStatus()
  584.     end
  585.     return
  586.  
  587. /*  -----------------------------------------------------------------*/
  588. NextEvent:
  589.     if ~Running() then say '..CyberCron isn''t running'
  590.     else do
  591.         numevents = ReadEvents()
  592.         if numevents = 0 then say '..no events queued'
  593.         else do
  594.             lasttime = word(ssc_id.1,1)    /* show all events queued for next time */
  595.             do i = 1 to numevents
  596.                 thistime = word(ssc_id.i,1)
  597.                 if thistime ~= lasttime then break
  598.                 id = word(ssc_id.i,2)
  599.                 say event.i
  600.                 lasttime = thistime
  601.             end i
  602.             say '  'ShowStatus()
  603.         end
  604.     end
  605.     return
  606.  
  607. /*  -------------------------------------------------------------  */
  608. Suspend_Resume:
  609.     running = Running()
  610.     if ~running then say '..CyberCron isn''t running'
  611.     else ''arg(1)''
  612.     return running
  613.  
  614. /*  -------------------------------------------------------------  */
  615. ShowStatus:    PROCEDURE
  616.     'SHOW_STATUS'
  617.     parse var result activity ' "' ctab '" "' lfile '"'
  618.     star = copies('*',activity='SUSPENDED')
  619.     if lfile = '<None>' then tmp = 'OFF'
  620.     else tmp = 'ON'
  621.     return 'Status:'star||activity||star 'Crontab='ctab 'Log='tmp
  622.  
  623. /*  -------------------------------------------------------------  */
  624. KillCyber:
  625.     if ~Running() then say '..CyberCron isn''t running'
  626.     else do
  627.         'QUIT'
  628.         do i = 1 to 10
  629.             call delay 25
  630.             if ~Running() then break
  631.         end i
  632.  
  633.         if i <= 10 then say '..CyberCron is dead'
  634.         else say '..CyberCron will quit after the current job is finished'
  635.     end
  636.     return
  637.  
  638. /*  -------------------------------------------------------------  */
  639. StartCyber:
  640.     if Running() then say '..CyberCron is already running'
  641.     else do
  642.         address 'COMMAND' 'run >NIL: <NIL:' startcmd
  643.  
  644.         do i = 1 to 10
  645.             call delay 25
  646.             if Running() then break
  647.         end i
  648.  
  649.         if i <= 10 then say '..CyberCron started'
  650.         else say '..couldn''t start' CyberCron || lf ||,
  651.         '  path set incorrectly under USER SETTABLE OPTIONS?'
  652.     end
  653.     return
  654.  
  655. /*  ------ 0=not running; 1=running ------------------------------  */
  656. Running:
  657.     return show('PORT','CYBERCRON')
  658.  
  659. /* ----------------------------------------------------------------
  660.  * no useful RC for illegal logfile, so ignore
  661.  */
  662. ToggleLog:    PROCEDURE EXPOSE logfile
  663.     if ~Running() then say '..CyberCron isn''t running'
  664.     else do
  665.         'SHOW_STATUS'        
  666.         parse var result . . logstat
  667.         if logstat = '"<None>"' then do
  668.             call writech 'STDOUT', ' Logfile is OFF; turn it ON? Y/n '
  669.             char = readln('STDIN')
  670.             if upper(char) ~= 'N' then do
  671.                 'NEW_LOG_FILE' logfile
  672.                 say '..'logfile 'turned ON'
  673.             end
  674.             else say '..aborted'
  675.         end
  676.         else do
  677.             call writech 'STDOUT', ' Logfile is ON; turn it OFF? Y/n '
  678.             char = readln('STDIN')
  679.             if upper(char) ~= 'N' then do
  680.                 'CLOSE_LOG_FILE'
  681.                 say '..'logfile 'turned OFF'
  682.             end
  683.             else say '..aborted'
  684.         end
  685.     end
  686.     return
  687.  
  688. /* ---------------------------------------------------------------- */
  689. MakeRaw:
  690.     call close 'STDOUT'
  691.     call close 'STDIN'
  692.     call open 'STDOUT','RAW:0/0/'screenwidth'/'screenheight'//NOSIZE'
  693.     call pragma '*','STDOUT'
  694.     call open 'STDIN','*'
  695.     return
  696.  
  697. /* ----------------------------------------------------------------  */
  698. Usage:
  699.     say 'Usage: cy -option'
  700.     say '    -e  edit crontab ['editor crontab']'
  701.     say '    -b  begin CyberCron ['CyberCron']'
  702.     say '    -q  quit (kill) CyberCron'
  703.     say '    -s  suspend'
  704.     say '    -r  resume'
  705.     say '    -n  next event(s) to execute'
  706.     say '    -l  list all events, sorted'
  707.     say '    -L  list all events, raw'
  708.     say '    -g  toggle the logfile ['logfile']'
  709.     say '        no option is the most fun'
  710.     say '   editor  =' editor
  711.     say '   logfile =' logfile
  712.     say '   crontab =' crontab
  713.     exit 0
  714.  
  715. ErX:
  716.     say arg(1)
  717.  
  718. HALT:
  719. BREAK_C:
  720.     exit 10
  721.